<?php

namespace JsonLowCode\Table\Column;

use JsonLowCode\UI;
use JsonLowCode\Table\BaseColumn;

/**
 * 单元表格评分渲染
 */
class Rate extends BaseColumn
{
    protected int $count = 5;

    protected string $color = "";

    /**
     * @param ...$parameters
     */
    public function __construct(...$parameters)
    {
        parent::__construct($parameters);
        $this->count = is_int($parameters[0])?$parameters[0]:5;
    }

    protected function booted(): void
    {
        $this->element = UI::rate($this->getColumnKey());
        $this->element->readonly();
        $this->element->count($this->count);
        $this->color&&$this->element->color($this->color);
    }
}
